/**
 * Copyright © 2009 Qasky. All rights reserved.
 *
 * 审计日志数据model
 *
 * @author Wang Hongya
 * @version 0.0.0 2019/10/14
 *
 * History:
 * (author, date, desc)
 * (Wang Hongya, 20191014, 添加注释)
 */
import {findAuditLogs, getAuditMedels} from 'api/sysAuditLogApi';

const sysAuditLog = {
    state: {
        auditItemsOpt: [],
        auditLogsPageData: [],
        page: {
            pageSize: 10,
            currentPage: 1
        }
    },
    mutations: {
        getAuditMedelOpts (state, obj) {
            state.auditItemsOpt = obj;
        },
        auditLogsData (state, obj) {
            state.auditLogsPageData = obj.rows;
            state.page.total = obj.total;
            state.page.pageSize = obj.pageSize;
            state.page.currentPage = obj.currentPage;
        },
    },
    actions: {
        /**
         * Function    : getAuditMedelsAct
         * Description : 获取审计日志搜索系统功能
         * Input       : context注册Actions   para传递的请求参数
         * Return      : 返回数据
         */
        getAuditMedelsAct (context) {
            getAuditMedels().then(response => {
                var data = response.data;
                context.commit('getAuditMedelOpts', data);
            });
        },
        /*获取审计日志列表*/
        findAuditLogsAct (context,para) {
            findAuditLogs(para).then(response => {
                var data = response.data;
                context.commit('auditLogsData', data);
            });
        }
    }
};

export default sysAuditLog;
